<template>
  <div>

        <div class="container layout layout-margin-top">
        
        
        <div class="row">
            <div class="col-md-9 layout-body">
                
        <div class="content">
            <!-- <div class="row"> -->
                
            <div role="tabpanel" class="tab-pane active" id="signin-form">
                        <form action="/login" method="post">
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon">
                                        <i class="fa fa-envelope" style="margin:0;"></i>
                                    </div>
                                    <input type="text" class="form-control" v-model="title" placeholder="title">
                                </div>
                            </div>
                            <br>
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon">
                                        <i class="fa fa-lock" style="margin:0;"></i>
                                    </div>
                                    <input type="text" class="form-control" v-model="chapters_id" placeholder="chapters_id">
                                </div>
                            </div>
                            <br>
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon">
                                        <i class="fa fa-lock" style="margin:0;"></i>
                                    </div>
                                    <input type="text" class="form-control" v-model="serial_num" placeholder="serial_num">
                                </div>
                            </div>
                            <br>
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon">
                                        <i class="fa fa-lock" style="margin:0;"></i>
                                    </div>
                                    <input type="text" class="form-control" v-model="learn_time" placeholder="learn_time">
                                </div>
                            </div>
                            <br>
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon">
                                        <i class="fa fa-lock" style="margin:0;"></i>
                                    </div>
                                    <input type="text" class="form-control" v-model="content" placeholder="content">
                                </div>
                            </div>
                            <br>
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon">
                                        <i class="fa fa-lock" style="margin:0;"></i>
                                    </div>
                                    <input type="text" class="form-control" v-model="video" placeholder="video">
                                </div>
                            </div>
                            <br>
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon">
                                        <i class="fa fa-lock" style="margin:0;"></i>
                                    </div>
                                    <input type="text" class="form-control" v-model="seq_num" placeholder="seq_num">
                                </div>
                            </div>
                            <br>
                          <div class="form-group">
                        <br>
                        <div v-width="300"><Button class="h-btn h-btn-text-green h-btn-block" @click="add_sections">添加小节</Button></div>

                        </div>
                        </form>
                    </div>
            <!-- </div> -->
        </div>

            </div>
                <div class="col-md-3 layout-side">
                </div>
            </div>
        </div>
  </div>
</template>

<script>
import {add_sections_post} from '../components/axios_api/api'
import comment from '../components/common/comment.vue';
export default {
    components: { comment },
    data(){
        return{
            title:'',
            token:'',
            chapters_id:'',
            serial_num:'',
            learn_time:'',
            content:'',
            video:'',
            seq_num:'',
        }
    },methods:{
            add_sections(){
            var data ={title:this.title,chapters_id:this.chapters_id,serial_num:this.serial_num,learn_time:this.learn_time,content:this.content,video:this.video,seq_num:this.seq_num}
            add_sections_post(data).then(resp=>{
            this.token = localStorage.getItem("token")
            console.log('添加成功',resp)
            if(resp.code==200){
            alert('添加成功')
            this.$router.push('/')
            }
            }).catch(err=>{
                console.log(err)
                alert('添加失败')
                this.$router.push('/')
            })
        },
    }
}
</script>

<style>

</style>